package com.gamecauca;

import java.util.ArrayList;
import java.util.List;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.gamecauca.animal.FishInfo;
import com.gamecauca.common.Constant;

public class Assets {
	public static Texture background;
	

	public static Texture items ;
	public static Texture playerDonothing;
	public static Texture playerThacau;
	public static Texture playerThacau0;
	public static Texture water; // cai nay la cai dong co cua thuyen
	public static Texture propeller; // cai nay la cai dong co cua thuyen
	public static Texture toolBoat; // cai nay la cai dong co cua thuyen
	public static Texture staticBoat;
	public static Texture dynamicBoat;
	public static Texture line; // cai nay la day cau nha pa con
	public static Texture hook; // cai nay la luoi cau nha pa con
	public static boolean enableHook; // cai nay la khi bat duoc ca thi no bat co thanh enable co nghia la chuyen sang hinh tay nam
	public static Texture goToLeft;
	public static Texture goToRight;
	public static Texture leftBar;
	public static Texture rightBar;
	public static Texture timerBar;
	public static boolean enabelLeft;
	public static boolean enabelRight;
	public static Texture fishing;
	public static Texture attack;
	public static Texture mainMenuButtons;
	public static Texture mainMenu;
	public static Texture blood;
	public static Texture streng;
	public static Texture bigCloud;
	public static Texture smallCloud;
	public static Texture blackCloud;
	public static Texture lighting;
	public static Texture nghingoi;
	public static Texture votca;
	public static Texture danhxuongnuoc;
	public static Texture caukoduocca;
	public static Texture chooseModeBoard;
	public static Texture chooseMode;
	public static Texture backButton;
	public static Texture bloodItem;
	public static Texture strengItem;
	public static TextureRegion bloodItemReginon[] = new TextureRegion[6];
	public static TextureRegion strengItemReginon[] = new TextureRegion[6];
	
	public static Texture[] bombTypes = new Texture[5];
	public static TextureRegion leftBombRegion[][] = new TextureRegion[5][6];
	public static TextureRegion rightBombRegion[][] = new TextureRegion[5][6];
	
	public static Texture  dogfree ;
	public static TextureRegion leftDogfree[] = new TextureRegion[6];
	public static TextureRegion rightDogfree[]  = new TextureRegion[6];
	public static Texture  dogVotca ;
	public static TextureRegion leftDogVotca[] = new TextureRegion[6];
	public static TextureRegion rightDogVotca[]  = new TextureRegion[6];
	
	public static Texture fish [] = new Texture[Constant.TOTAL_FISH];
	public static TextureRegion fishRegionLeft [][] =  new TextureRegion [Constant.TOTAL_FISH][6];
	public static TextureRegion fishRegionRight [][] =  new TextureRegion [Constant.TOTAL_FISH][6];
	
	public static Texture captureFish [] = new Texture[Constant.TOTAL_FISH];
	public static TextureRegion captureFishRegionLeft [][] =  new TextureRegion [Constant.TOTAL_FISH][3];
	public static TextureRegion captureFishRegionRight [][] =  new TextureRegion [Constant.TOTAL_FISH][3];
	
	public static Texture noCaptureFish [] = new Texture[Constant.TOTAL_FISH];
	public static TextureRegion noCaptureFishRegionLeft [][] =  new TextureRegion [Constant.TOTAL_FISH][3];
	public static TextureRegion noCaptureFishRegionRight [][] =  new TextureRegion [Constant.TOTAL_FISH][3];
	
	public static Texture deadFish [] = new Texture[Constant.TOTAL_FISH];
	public static TextureRegion deadFishRegion [] =  new TextureRegion [Constant.TOTAL_FISH];

	public static int[] fishRegionWidth = new int[Constant.TOTAL_FISH];
	public static int[] fishRegionHeight = new int[Constant.TOTAL_FISH];
	public static int[] bombRegionWidth = new int[5];
	public static int[] bombRegionHeight = new int[5];
	
	public static TextureRegion chooseModeBoardRegion;
	public static TextureRegion chooseModeRegion[][]= new TextureRegion[2][2] ;

	public static TextureRegion backgroundRegion;
	public static TextureRegion backButtonRegion [] = new TextureRegion [2];
	public static TextureRegion PlayButtonsRegion [] = new TextureRegion[2] ;
	public static TextureRegion loadGameButtonsRegion [] = new TextureRegion[2] ;
	public static TextureRegion hightscoreButtonsRegion [] = new TextureRegion[2] ;
	public static TextureRegion helpButtonsRegion [] = new TextureRegion[2] ;
	public static TextureRegion creditButtonsRegion [] = new TextureRegion[2] ;
	public static TextureRegion quitButtonsRegion [] = new TextureRegion[2] ;
	public static TextureRegion[] goToLeftRegion = new TextureRegion[2];//button left co 2 hinh
	public static TextureRegion[] goToRightRegion = new TextureRegion[2];//button right co 2 hinh
	
	public static TextureRegion waterRegion;
	public static TextureRegion lineRegion; // region cua day cau 
	public static TextureRegion staticboatGoRight[] = new TextureRegion[6]; // mui thuyen quay ve phia ben phai
	public static TextureRegion staticboatGoLeft[] = new TextureRegion[6]; // mui thuyen quay ve phia ben phai
	public static TextureRegion dynamicboatGoRight[] = new TextureRegion[6]; // mui thuyen quay ve phia ben phai
	public static TextureRegion dynamicboatGoLeft[] = new TextureRegion[6]; // mui thuyen quay ve phia ben phai
	public static TextureRegion toolBoatRight; // tool boat cua thuyen nam phia sau thuyen (mui thuyen quay ve ben phai) 
	public static TextureRegion toolBoatLeft; // tool boat cua thuyen nam phia sau thuyen (mui thuyen quay ve ben trai)
	public static TextureRegion playerRight[] = new TextureRegion[6]; // mat nguoi cau ca quay ve phia ben phai
	public static TextureRegion playerLeft[] = new TextureRegion[6]; // mat nguoi cau ca quay ve phia ben phai
	
	public static TextureRegion playerLeftThacau[] = new TextureRegion[6];
	public static TextureRegion playerRightThacau[] = new TextureRegion[6];
	public static TextureRegion playerLeftThacau0[] = new TextureRegion[6];
	public static TextureRegion playerRightThacau0[] = new TextureRegion[6];
	
	public static TextureRegion propellerRegion;
	public static TextureRegion[] catchHandRegion = new TextureRegion[2];//hinh ban tay cau ca, hinh la la hinh nguyen mau, hinh 2 la highlight
	public static TextureRegion[] hookRegion = new TextureRegion[2];//hinh ban luoi cau cau ca, hinh la la hinh nguyen mau, hinh 2 la highlight
	public static TextureRegion attackRegion []= new TextureRegion[2];
	public static TextureRegion mainMenuRegion;
	
	public static TextureRegion rightBarRegion;
	public static TextureRegion leftBarRegion;
	public static TextureRegion bloodRegion;
	public static TextureRegion strengRegion;
	public static TextureRegion timerBarRegion;
	public static TextureRegion marketRegion;
	
	public static TextureRegion bigCloudRegion;
	public static TextureRegion smallCloudRegion;
	public static TextureRegion blackCloudRegion;
	public static TextureRegion lightingRegion;
	
//	public static Animation mucAnimation;
	
	public static TextureRegion [] mucRegion =  new TextureRegion[6];
	
	public static Texture[] fireBombTexture = new Texture[5];
	public static TextureRegion[][] fireBombTextureRegion = new TextureRegion[5][6];
	public static int[] fireBombRegionWidth = new int[5];
	public static int[] fireBombRegionHeight = new int[5];
	
	public static Music music;
	public static Sound jumpSound;
	/*************************************************************************************************/
	/*************************************************************************************************/
	/********bat dau  phan cua duoc ******************************************************************/
	public static Texture marketBackground;
	public static Texture catalogBackground;
	public static Texture catalogContainer;
	public static Texture facebookTexture;
	public static Texture twitterTexture;
	
	public static Texture fishTab;
	public static Texture itemTab;
	

//	public static Texture fishs [] = new Texture[Constant.TOTAL_FISH];

	public static TextureRegion[][] ITEM_TYPE_1;
	public static TextureRegion[][] ITEM_TYPE_2;

	public static TextureRegion marketBackgroundRegion;
	public static TextureRegion catalogBackgroundRegion;
	public static TextureRegion catalogContainerRegion;
	
	public static TextureRegion fishTabRegion;
	public static TextureRegion itemTabRegion;
	
	public static TextureRegion fishRegionTabInfo [][] =  new TextureRegion [Constant.TOTAL_FISH][1];
	public static List<FishInfo> fishInfoList;
	
	public static int itemSelection = 1;
	
	public static Texture[] itemImgs;
	public static List<ItemDetails> itemList;
	
	public static List<ItemDetails> userItems;
	public static List<ItemDetails> userBox;
	
	public static TextureRegion[][] buy;
	//public static Texture buyHighlight;
	public static TextureRegion[][] sell;
	//public static Texture sellHighlight;
	public static Texture gold;
	public static Texture marketImg;
	public static Texture boxImg;
	public static Texture container;
	
	public static final int PADDING = 20;
	public static final int firstPADDING = PADDING;
	
	public static BitmapFont font;
	public static BitmapFont collectMoneyFont;
	
	
	/******* ket thuc phan cua duoc *********************/
	/*************************************************************************************************/
	/*************************************************************************************************/

	public static Texture loadTexture (String file) {
		return new Texture(Gdx.files.internal(file));
	}

	public static void load () {
		
		background = loadTexture("data/imagine/background2.png");
		goToLeft = loadTexture("data/imagine/buttonLeft.png");
		goToRight = loadTexture("data/imagine/buttonRight.png");
		water = loadTexture("data/imagine/water.png");
		line = loadTexture("data/imagine/line.png");
		hook = loadTexture("data/imagine/bantay.png");
		staticBoat = loadTexture("data/imagine/chuyendongnhe.png");
		dynamicBoat = loadTexture("data/imagine/chuyendongmanh.png");
		toolBoat = loadTexture("data/imagine/toolBoat.png");
		propeller = loadTexture("data/imagine/propeller.png");
		playerDonothing = loadTexture("data/imagine/nghingoi.png");
		fishing = loadTexture("data/imagine/buttonHand.png");
		attack = loadTexture("data/imagine//buttonFire.png");
		mainMenu = loadTexture("data/imagine/mainmenu.png");
		bloodItem = loadTexture("data/imagine/blooditem.png");
		strengItem = loadTexture("data/imagine/strengitem.png");
		
		rightBar = loadTexture("data/imagine/RightBar.png");
		leftBar = loadTexture("data/imagine/Leftbar.png");
		playerThacau = loadTexture("data/imagine/thacau.png");
		playerThacau0 = loadTexture("data/imagine/thacau0.png");
		
		blood = loadTexture("data/imagine/HPbar1.png");
		streng = loadTexture("data/imagine/HPbar.png");
		timerBar = loadTexture("data/imagine/timerbar.png");
		
		mainMenuButtons = loadTexture("data/imagine/mapmainMenu.png");
		
		bigCloud = loadTexture("data/imagine/mayto.png");
		smallCloud = loadTexture("data/imagine/maynho.png");
		blackCloud = loadTexture("data/imagine/mayden.png");
		lighting = loadTexture("data/imagine/samset.png");
		chooseModeBoard = loadTexture("data/imagine/menuchoosemode.png");
		chooseMode = loadTexture("data/imagine/choosemode.png");
		backButton = loadTexture("data/imagine/backbutton.png");
		
		dogfree = loadTexture("data/imagine/dogfree.png");
		dogVotca = loadTexture("data/imagine/dogvotca.png");
		for(int i = 0;i< leftDogfree.length;i++){
			leftDogfree[i] = new TextureRegion(dogfree, i*52, 0, 52, 61);
			rightDogfree[i] = new TextureRegion(dogfree, i*52, 0, 52, 61);
			rightDogfree[i].flip(true, false);
		}
		for(int i = 0;i< leftDogVotca.length;i++){
			leftDogVotca[i] = new TextureRegion(dogVotca, i*122, 0, 122, 75);
			rightDogVotca[i] = new TextureRegion(dogVotca,i*122, 0, 122, 75);
			rightDogVotca[i].flip(true, false);
		}
		chooseModeBoardRegion = new TextureRegion(chooseModeBoard, 0, 0,800,480);
		for(int i = 0;i<2;i++){
			for(int j =0;j<2;j++){
				chooseModeRegion[i][j] = new TextureRegion(chooseMode, 0+256*j, 0+128*i,256,128);
			}
		}
		backgroundRegion = new TextureRegion(background, 0, 0,800,480);
		for(int i = 0;i< goToLeftRegion.length;i++){
			goToLeftRegion[i] = new TextureRegion(goToLeft, i*64, 0, 64, 64);
			// hinh thu nhat la hinh nguyen mau goToRightRegion[0], hinh thu 2 la hinh highlight goToRightRegion[1]
		}
		for(int i = 0;i< goToLeftRegion.length;i++){
			goToRightRegion[i] = new TextureRegion(goToRight, i*64, 0, 64, 64);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}
		for(int i = 0;i< PlayButtonsRegion.length;i++){
			PlayButtonsRegion[i] = new TextureRegion(mainMenuButtons, i*128, 0, 128, 128);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}
		for(int i = 0;i< loadGameButtonsRegion.length;i++){
			loadGameButtonsRegion[i] = new TextureRegion(mainMenuButtons,256+i*128, 0, 128, 128);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}
		for(int i = 0;i< hightscoreButtonsRegion.length;i++){
			hightscoreButtonsRegion[i] = new TextureRegion(mainMenuButtons, 256*2+i*128, 0, 128, 128);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}
		for(int i = 0;i< helpButtonsRegion.length;i++){
			helpButtonsRegion[i] = new TextureRegion(mainMenuButtons, 256*3+i*128, 0, 128, 128);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}
		for(int i = 0;i< creditButtonsRegion.length;i++){
			creditButtonsRegion[i] = new TextureRegion(mainMenuButtons, i*128, 128, 128, 128);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}
		for(int i = 0;i<quitButtonsRegion.length;i++){
			quitButtonsRegion[i] = new TextureRegion(mainMenuButtons, 256+i*128, 128, 128, 128);
			// hinh thu nhat la hinh highlight goToRightRegion[0], hinh thu 2 la hinh nguyen mau goToRightRegion[1]
		}

		
		loadFishPosition();
		loadBombPosition();
		loadFireBombPosition();
		for(int i = 0;i<backButtonRegion.length;i++){
			backButtonRegion[i] = new TextureRegion(backButton, 0,64*i, 128, 64);
		}
		
		for(int i = 0;i < fish.length;i++){
			fish[i] = loadTexture("data/imagine/fish"+(i+1)+".png");
		}
		for(int i = 0;i < Constant.TOTAL_FISH; i++){
			for(int j = 0; j < 6; j++){
					
				fishRegionLeft[i][j] = new TextureRegion(fish[i], j * fishRegionWidth[i], 0, fishRegionWidth[i], fishRegionHeight[i]);
				fishRegionRight[i][j] = new TextureRegion(fish[i], j * fishRegionWidth[i], 0, fishRegionWidth[i], fishRegionHeight[i]);
				fishRegionRight[i][j].flip(true, false);
			}
		}
		for(int i = 0;i < captureFish.length;i++){
			captureFish[i] = loadTexture("data/imagine/capturefish"+(i+1)+".png");
		}
		for(int i = 0;i < Constant.TOTAL_FISH; i++){
			for(int j = 0; j < 3; j++){
					
				captureFishRegionLeft[i][j] = new TextureRegion(captureFish[i], j * fishRegionWidth[i], 0, fishRegionWidth[i], fishRegionHeight[i]);
				captureFishRegionRight[i][j] = new TextureRegion(captureFish[i], j * fishRegionWidth[i], 0, fishRegionWidth[i], fishRegionHeight[i]);
				captureFishRegionRight[i][j].flip(true, false);
			}
		}
		for(int i = 0;i < noCaptureFish.length;i++){
			noCaptureFish[i] = loadTexture("data/imagine/nocapture"+(i+1)+".png");
		}
		for(int i = 0;i < Constant.TOTAL_FISH; i++){
			for(int j = 0; j < 3; j++){
					
				noCaptureFishRegionLeft[i][j] = new TextureRegion(noCaptureFish[i], j * fishRegionWidth[i], 0, fishRegionWidth[i], fishRegionHeight[i]);
				noCaptureFishRegionRight[i][j] = new TextureRegion(noCaptureFish[i], j * fishRegionWidth[i], 0, fishRegionWidth[i], fishRegionHeight[i]);
				noCaptureFishRegionRight[i][j].flip(true, false);
			}
		}
		for(int i = 0;i < deadFish.length;i++){
			deadFish[i] = loadTexture("data/imagine/deadfish"+(i+1)+".png");
		}
		for(int i = 0;i < Constant.TOTAL_FISH; i++){
					
				deadFishRegion[i] = new TextureRegion(deadFish[i],0, 0, fishRegionWidth[i], fishRegionHeight[i]);
		}
		for(int i = 0;i < staticboatGoLeft.length;i++){
			staticboatGoLeft[i] = new TextureRegion(staticBoat, 0+141*i, 0,141,40);
			staticboatGoRight[i] = new TextureRegion(staticBoat, 0+141*i, 0,141,40);
			staticboatGoRight[i].flip(true, false);
			
		}
		for(int i = 0;i < dynamicboatGoLeft.length;i++){
			dynamicboatGoLeft[i] = new TextureRegion(dynamicBoat, 0+141*i, 0,141,60);
			dynamicboatGoRight[i] = new TextureRegion(dynamicBoat, 0+141*i, 0,141,60);
			dynamicboatGoRight[i].flip(true, false);
			
		}
		for(int i = 0;i < playerLeft.length;i++){
			playerLeft[i] = new TextureRegion(playerDonothing, 0+51*i, 0,51,132);
			playerRight[i] = new TextureRegion(playerDonothing,  0+51*i, 0,51,132);
			playerRight[i].flip(true, false);
			
		}
		for(int i = 0;i < playerLeftThacau.length;i++){
			playerLeftThacau[i] = new TextureRegion(playerThacau, 0+156*i, 0,156,68);
			playerRightThacau[i] = new TextureRegion(playerThacau, 0+156*i, 0,156,68);
			playerRightThacau[i].flip(true, false);
			
		}
		toolBoatRight = new TextureRegion(toolBoat, 0, 0,64,64);
		toolBoatRight.flip(false, false);
		toolBoatLeft = new TextureRegion(toolBoat, 0, 0,64,64);
		toolBoatLeft.flip(true, false);// flip xoay hinh theo truc x flip(x,y)
		
		lineRegion = new TextureRegion(line, 0, 0, 2, 10);
		waterRegion = new TextureRegion(water, 0, 0, 1024, 512);
		propellerRegion = new TextureRegion(propeller, 0, 0, 32, 32);
		
		
		for(int i = 0;i< catchHandRegion.length;i++){
			catchHandRegion[i] = new TextureRegion(fishing, i*64, 0, 64, 64);
			// hinh thu nhat la hinh highlight catchHandRegion[0], hinh thu 2 la hinh nguyen mau catchHandRegion[1]
		}
		for(int i = 0;i< hookRegion.length;i++){
			hookRegion[i] = new TextureRegion(hook, i*32, 0, 32, 35);
			// hinh thu nhat la hinh highlight catchHandRegion[0], hinh thu 2 la hinh nguyen mau catchHandRegion[1]
		}
		for(int i = 0;i< attackRegion.length;i++){
			attackRegion[i] = new TextureRegion(attack, i*64, 0, 64,64);
		}
		mainMenuRegion = new TextureRegion(mainMenu, 0, 0, 800, 480);
		
		//=============================================================
		
		bombTypes[0] = loadTexture("data/imagine/bom nho.png");
		bombTypes[1] = loadTexture("data/imagine/bom lon.png");
		bombTypes[2] = loadTexture("data/imagine/bom hoa hoc.png");
		bombTypes[3] = loadTexture("data/imagine/bom bang.png");
		bombTypes[4] = loadTexture("data/imagine/binh dien.png");
		
		for(int i = 0;i < 5; i++){
			for(int j = 0; j < 6; j++){
					
				leftBombRegion[i][j] = new TextureRegion(bombTypes[i], j * bombRegionWidth[i], 0, bombRegionWidth[i], bombRegionHeight[i]);
				rightBombRegion[i][j] = new TextureRegion(bombTypes[i], j * bombRegionWidth[i], 0, bombRegionWidth[i], bombRegionHeight[i]);
				rightBombRegion[i][j].flip(true, false);
				
			}
		}
		
		fireBombTexture[0] = loadTexture("data/imagine/hieu ung bom nho.png");
		fireBombTexture[1] = loadTexture("data/imagine/hieu ung bom lon.png");
		
		fireBombTexture[2] = loadTexture("data/imagine/hieu ung bom hoa hoc.png");
		fireBombTexture[3] = loadTexture("data/imagine/hieu ung bom bang.png");
		fireBombTexture[4] = loadTexture("data/imagine/hieu ung dien giat.png");
		
		for(int i = 0; i < 5; i++)
		{
			for(int j = 0; j < 6; j++){
				fireBombTextureRegion[i][j] = new TextureRegion(fireBombTexture[i], j * fireBombRegionWidth[i], 0, fireBombRegionWidth[i], fireBombRegionHeight[i]);
			}
		}
	
		leftBarRegion = new TextureRegion(leftBar, 25, 25,250,75);
		rightBarRegion= new TextureRegion(rightBar, 15, 15,250,85);
		
		bloodRegion= new TextureRegion(blood, 0, 0,100,8);
		strengRegion = new TextureRegion(streng, 0, 0,100,8);
		timerBarRegion = new TextureRegion(timerBar, 0, 0,128,8);
		
		bigCloudRegion = new TextureRegion(bigCloud, 0, 0,256,128);
		smallCloudRegion = new TextureRegion(smallCloud, 0, 0,128,64);
		blackCloudRegion = new TextureRegion(blackCloud, 0, 0,256,128);
		lightingRegion = new TextureRegion(lighting, 0, 0,128,128);
		/*************************************************************************************************/
		/*************************************************************************************************/
		/********bat dau  phan cua duoc ******************************************************************/
		marketBackground = loadTexture("data/imagine/shop.png");
		marketBackgroundRegion = new TextureRegion(marketBackground);
		
		fishTab = loadTexture("data/imagine/fish-tab.png");
		itemTab = loadTexture("data/imagine/item-tab.png");
		facebookTexture = loadTexture("data/imagine/facebookIcon.png");
		twitterTexture = loadTexture("data/imagine/twitter_test.png");
		
		catalogBackground = loadTexture("data/imagine/menu_catalog.png");
		catalogBackgroundRegion = new TextureRegion(catalogBackground, 0, 0, 800, 480);
		catalogContainer = loadTexture("data/imagine/fish-board.png");
		catalogContainerRegion = new TextureRegion(catalogContainer, 120, 15, 355, 85);
		
		fishTabRegion = new TextureRegion(fishTab, 0, 0, 100, 64);
		itemTabRegion = new TextureRegion(itemTab, 0, 0, 100, 64);
		
		
//		for(int i = 0;i<fishs.length;i++){	
//			fishRegionTabInfo[i][0] = new TextureRegion(fishs[i], 0*64, 0, 64, 64);
//			fishRegionTabInfo[i][0].flip(true, false);		
//		}
		
		
		ITEM_TYPE_1 = split("data/imagine/buttonMove1.png", 64, 32, false);
		ITEM_TYPE_2 = split("data/imagine/buttonMove1.png", 64, 32, true);
		
		buy = split("data/imagine/buybutton1.png", 64, 32, false);
		//buyHighlight = loadTexture("data/buybutton1.png");
		sell = split("data/imagine/sellButton1.png", 64, 32, false);
		//sellHighlight = loadTexture("data/sellButton1.png");
		gold = loadTexture("data/imagine/money-icon.png");
		marketImg = loadTexture("data/imagine/iconMarket.png");
		
		marketRegion= new TextureRegion(marketImg, 0, 0,32,32);
		boxImg = loadTexture("data/imagine/icon-bag.png");
		container = loadTexture("data/imagine/container.png");
		
		font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);	
//		font = TrueTypeFontFactory.createBitmapFont(Gdx.files.internal("data/DroidSerif-Regular.ttf"), Constant.FONT_CHARACTERS, 15.0f, 10.0f, 1.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		collectMoneyFont = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);

		
		itemImgs = new Texture[30];
		itemList = new ArrayList<ItemDetails>();
		
		userItems = new ArrayList<ItemDetails>();
		userBox = new ArrayList<ItemDetails>();
		fishInfoList = new ArrayList<FishInfo>();
		
		loadFishInfos();
		loadItem1();
		loadItem2();
		loadItem3();
		loadItem4();
		/******* ket thuc phan cua duoc *********************/
		/*************************************************************************************************/
		/*************************************************************************************************/
	}
	
	public static void loadFishInfos(){
		
		fishInfoList.add(new FishInfo("Fish 1", "This is fish 1"));
		fishInfoList.add(new FishInfo("Fish 2", "This is fish 2"));
		fishInfoList.add(new FishInfo("Fish 3", "This is fish 3"));
		fishInfoList.add(new FishInfo("Fish 4", "This is fish 4"));
		fishInfoList.add(new FishInfo("Fish 5", "This is fish 5"));
		fishInfoList.add(new FishInfo("Fish 6", "This is fish 6"));
		fishInfoList.add(new FishInfo("Fish 7", "This is fish 7"));
		fishInfoList.add(new FishInfo("Fish 8", "This is fish 8"));
		fishInfoList.add(new FishInfo("Fish 9", "This is fish 9"));
		fishInfoList.add(new FishInfo("Fish 10", "This is fish 10"));
		
		fishInfoList.add(new FishInfo("Fish 11", "This is fish 11"));
		fishInfoList.add(new FishInfo("Fish 12", "This is fish 12"));
		fishInfoList.add(new FishInfo("Fish 13", "This is fish 13"));
		fishInfoList.add(new FishInfo("Fish 14", "This is fish 14"));
		fishInfoList.add(new FishInfo("Fish 15", "This is fish 15"));
		fishInfoList.add(new FishInfo("Fish 16", "This is fish 16"));
		fishInfoList.add(new FishInfo("Fish 17", "This is fish 17"));
		fishInfoList.add(new FishInfo("Fish 18", "This is fish 18"));
		fishInfoList.add(new FishInfo("Fish 19", "This is fish 19"));
		fishInfoList.add(new FishInfo("Fish 20", "This is fish 20"));
		fishInfoList.add(new FishInfo("Fish 21", "This is fish 21"));	
	}
	
	public static void loadItem1(){
		// ITEM TYPE 1
		itemImgs[0] = loadTexture("data/imagine/bread.png");
		itemImgs[1] = loadTexture("data/imagine/cigar.png");
		itemImgs[2] = loadTexture("data/imagine/sandOclock.png");
		itemImgs[3] = loadTexture("data/imagine/bom nho market.png");
		itemImgs[4] = loadTexture("data/imagine/shortLine.png");
		itemImgs[5] = loadTexture("data/imagine/hat.png");
		itemImgs[6] = loadTexture("data/imagine/hamberger.png");
		itemImgs[7] = loadTexture("data/imagine/yellowbottle.png");
		itemImgs[8] = loadTexture("data/imagine/oclock.png");
		// 59 80/70 64
		itemList.add(new ItemDetails(0, 300, "Bread", "This is Bread", 10, "Health", 1, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(1, 400, "Cigar", "This is Cigar", 10, "Strength", 1, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(2, 500, "Sand", "This is Sand\nOclock", 10, "Time", 1, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		
		itemList.add(new ItemDetails(3, 600, "Bomb", "This is Bomb", 10, "Bomb", 1 ,firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(4, 700, "Line", "This is Short Line", 10, "Line", 1, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(5, 800, "Hat", "This is Hat", 10, "Protect", 1, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		
		itemList.add(new ItemDetails(6, 500, "Hamber", "This is Hamberger", 10, "Health", 2, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(7, 600, "Bottle", "This is Yellow\nBottle", 10, "Strength", 2, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(8, 700, "Oclock", "This is Oclock", 10, "Time", 2, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
	}
	
	public static void loadItem2(){
		// ITEM TYPE 2
		itemImgs[9] = loadTexture("data/imagine/bom lon market.png");
		itemImgs[10] = loadTexture("data/imagine/longLine.png");
		itemImgs[11] = loadTexture("data/imagine/umbrella.png");
		itemImgs[12] = loadTexture("data/imagine/Chung-cake.png");
		itemImgs[13] = loadTexture("data/imagine/violetbottle.png");
		itemImgs[14] = loadTexture("data/imagine/watch.png");
		itemImgs[15] = loadTexture("data/imagine/bom hoa hoc maket.png");
		itemImgs[16] = loadTexture("data/imagine/foot-of-chicken.png");
		itemImgs[17] = loadTexture("data/imagine/blue-bottle.png");
		
		itemList.add(new ItemDetails(9, 800, "Bomb" , "This is Big Bomb", 10, "Bomb", 2, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(10, 900, "Line", "This is Long Line", 10, "Line", 2, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(11, 1000, "Umbre", "This is Umbrella", 10, "Protect", 2, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		
		itemList.add(new ItemDetails(12, 700, "Cake", "This is Chung\nCake", 10, "Health" , 3, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(13, 800, "Bottle", "This is Violet\nBottle", 10, "Strength", 3, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(14, 900, "Watch", "This is Watch", 10, "Time", 3, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		
		itemList.add(new ItemDetails(15, 1000, "Bomb", "This is Biological\nBomb", 10, "Bomb", 3, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(16, 900, "Chicken", "This is Chicken", 10, "Health", 4, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(17, 1000, "Bottle", "This is Blue\nBottle", 10, "Strength", 4, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
	}
	
	public static void loadItem3(){
		
		itemImgs[18] = loadTexture("data/imagine/bom bang market.png");
		itemImgs[19] = loadTexture("data/imagine/noodle.png");
		itemImgs[20] = loadTexture("data/imagine/smallWine.png");
		itemImgs[21] = loadTexture("data/imagine/binh dien market.png");
		itemImgs[22] = loadTexture("data/imagine/hellPill.png");
		itemImgs[23] = loadTexture("data/imagine/bigwine.png");
		itemImgs[24] = loadTexture("data/imagine/timebottle.png");
		itemImgs[25] = loadTexture("data/imagine/woman-wine.png");
		itemImgs[26] = loadTexture("data/imagine/milk.png");
		
		itemList.add(new ItemDetails(18, 1200, "Bomb", "This is Ice Bomb", 10, "Bomb", 4, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(19, 1100, "Noodle", "This is Noodle", 10, "Health", 5, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(20, 1200, "Wine", "This is Small Wine", 10, "Strength", 5, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		
		itemList.add(new ItemDetails(21, 1400, "Bomb", "This is Acquy\nBomb", 10, "Bomb", 5, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(22, 1300, "Pill", "This is Hell Pill", 10, "Health", 6, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(23, 1400, "Wine", "This is Big Wine", 10, "Strength", 6, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 1*(PADDING + 64) + 3));
		
		itemList.add(new ItemDetails(24, 1500, "Bottle", "This is Time\nBottle", 10, "Health", 7, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(25, 1600, "Wine", "This is Woman\nWine", 10, "Strength", 7, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
		itemList.add(new ItemDetails(26, 1700, "Milk", "This is Milk", 10, "Health", 8, firstPADDING + 2*(PADDING + 64) - 4, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 - 2*(PADDING + 64) + 3));
	}
	
	public static void loadItem4(){
		
		itemImgs[27] = loadTexture("data/imagine/apple.png");
		itemImgs[28] = loadTexture("data/imagine/ice-cream.png");
		
		
		itemList.add(new ItemDetails(27, 1800, "Apple", "This is Apple", 10, "Strength", 8, firstPADDING + 13, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		itemList.add(new ItemDetails(28, 2000, "Ice", "This is Ice Cream", 10, "Strength", 9, firstPADDING + 1*(PADDING + 64) + 3, (192 + (PADDING*2)) + (Constant.SCREEN_HEIGHT - (192 + (PADDING*2)))/2 - 64 + 3));
		
	}

	public static void playSound (Sound sound) {
//		if (Settings.soundEnabled) sound.play(1);
	}
	
	public static void loadFishPosition(){
		
//		fishRegionWidth[0] = 53;
//		fishRegionWidth[1] = 105;
//		fishRegionWidth[2] = 99;
//		fishRegionWidth[3] = 53;
//		fishRegionWidth[4] = 74;
//		fishRegionWidth[5] = 70;
//		fishRegionWidth[6] = 52;
//		fishRegionWidth[7] = 122;
//		fishRegionWidth[8] = 137;
//		fishRegionWidth[9] = 53;
//		fishRegionWidth[10] = 120;
//		fishRegionWidth[11] = 64;
//		fishRegionWidth[12] = 55;
//		fishRegionWidth[13] = 136;
//		fishRegionWidth[14] = 65;
//		fishRegionWidth[15] = 100;
//		fishRegionWidth[16] = 76;
//		fishRegionWidth[17] = 80;
//		fishRegionWidth[18] = 80;
//		fishRegionWidth[19] = 130;
//		
//		
//				
//		//--------------------------
//		
//		fishRegionHeight[0] = 48;
//		fishRegionHeight[1] = 90;
//		fishRegionHeight[2] = 70;
//		fishRegionHeight[3] = 64;
//		fishRegionHeight[4] = 64;
//		fishRegionHeight[5] = 64;
//		fishRegionHeight[6] = 50;	
//		fishRegionHeight[7] = 70;
//		fishRegionHeight[8] = 64;
//		fishRegionHeight[9] = 50;
//		fishRegionHeight[10] = 90;
//		fishRegionHeight[11] = 64;
//		fishRegionHeight[12] = 64;
//		fishRegionHeight[13] = 110;
//		fishRegionHeight[14] = 64;
//		fishRegionHeight[15] = 80;
//		fishRegionHeight[16] = 80;
//		fishRegionHeight[17] = 90;
//		fishRegionHeight[18] = 80;
//		fishRegionHeight[19] = 100;
		
		fishRegionWidth[0] = 53;
		fishRegionWidth[1] = 53;
		fishRegionWidth[2] = 64;
		fishRegionWidth[3] = 84;
		fishRegionWidth[4] = 74;
		fishRegionWidth[5] = 70;
		fishRegionWidth[6] = 52;
		fishRegionWidth[7] = 55;
		fishRegionWidth[8] = 137;
		fishRegionWidth[9] = 120;
		fishRegionWidth[10] = 99;
		fishRegionWidth[11] = 53;
		fishRegionWidth[12] = 136;
		fishRegionWidth[13] = 105;
		fishRegionWidth[14] = 122;
		fishRegionWidth[15] = 100;
		fishRegionWidth[16] = 76;
		fishRegionWidth[17] = 80;
		fishRegionWidth[18] = 80;
		fishRegionWidth[19] = 130;
		
		
				
		//--------------------------
		
		fishRegionHeight[0] = 48;
		fishRegionHeight[1] = 50;
		fishRegionHeight[2] = 64;
		fishRegionHeight[3] = 78;
		fishRegionHeight[4] = 64;
		fishRegionHeight[5] = 64;
		fishRegionHeight[6] = 50;	
		fishRegionHeight[7] = 64;
		fishRegionHeight[8] = 64;
		fishRegionHeight[9] = 90;
		fishRegionHeight[10] = 70;
		fishRegionHeight[11] = 64;
		fishRegionHeight[12] = 110;
		fishRegionHeight[13] = 90;
		fishRegionHeight[14] = 70;
		fishRegionHeight[15] = 80;
		fishRegionHeight[16] = 80;
		fishRegionHeight[17] = 90;
		fishRegionHeight[18] = 80;
		fishRegionHeight[19] = 100;
		
		
		
	}
	
	public static void loadBombPosition(){
		
		bombRegionWidth[0] = 64;
		bombRegionWidth[1] = 80;
		bombRegionWidth[2] = 59;
		bombRegionWidth[3] = 59;
		bombRegionWidth[4] = 50;
		
		//============================
		
		bombRegionHeight[0] = 64;
		bombRegionHeight[1] = 70;
		bombRegionHeight[2] = 64;
		bombRegionHeight[3] = 64;
		bombRegionHeight[4] = 64;
		
	}
	
	public static void loadFireBombPosition(){
		
		fireBombRegionWidth[0] = 167;
		fireBombRegionWidth[1] = 233;
		fireBombRegionWidth[2] = 260;
		fireBombRegionWidth[3] = 282;
		fireBombRegionWidth[4] = 250;
		
		//===========================
		
		fireBombRegionHeight[0] = 170;
		fireBombRegionHeight[1] = 210;
		fireBombRegionHeight[2] = 160;
		fireBombRegionHeight[3] = 180;
		fireBombRegionHeight[4] = 128;
	}
	
	
	private static TextureRegion[][] split (String name, int width, int height, boolean flipX) {
		Texture texture = new Texture(Gdx.files.internal(name));
		int xSlices = texture.getWidth() / width;
		int ySlices = texture.getHeight() / height;
		TextureRegion[][] res = new TextureRegion[xSlices][ySlices];
		for (int x = 0; x < xSlices; x++) {
			for (int y = 0; y < ySlices; y++) {
				res[x][y] = new TextureRegion(texture, x * width, y * height, width, height);
				
				if(flipX)
				res[x][y].flip(flipX, true);
			}
		}
		return res;
	}
}

